---
title: "Online Appendix"
subtitle: "Acculturation Orientations and Latino Political Behavior"
author: "Jessala A. Grijalva"
date: "`r format(Sys.Date(), '%B %d, %Y')`"
format:
  pdf:
    toc: true
    toc-depth: 2
    number-sections: false
    geometry: margin=1in
    colorlinks: true
    keep-tex: false
execute:
  warning: false
  message: false
  echo: false
---

```{r setup}
#| label: setup

library(here)
library(pacman)
p_load(tidyverse, knitr, kableExtra, car)

# ── Publishing Standards ──
dvs <- c("IDEOLOGY", "PARTYID", "IMMVIEW", "DREAMACT", "IMMPOLICY")
label_vars <- function(x) unname(VAR_LABELS[x])

# ── Load precomputed results ──
# Phase 2 validation (BAM clustering)
load(here("data", "processed", "phase2_validation_results.rda"))
vr <- validation_results

# Phase 3 political analysis (avoids re-running bootstrap)
# Render Phase_3_Political_Profiles.qmd first to generate this file
load(here("data", "processed", "phase3_results.rda"))

# ── Visual Standards ──
ORIENTATION_FILLS <- c(
  "Culture Affirming" = "gray15",
  "Assimilationist"   = "gray40",
  "Demicultural"      = "gray65",
  "Bicultural"        = "gray85"
)

VAR_LABELS <- c(
  "IDEOLOGY"  = "Ideology",
  "PARTYID"   = "Party Identification",
  "IMMVIEW"   = "Immigration View",
  "DREAMACT"  = "DREAM Act Support",
  "IMMPOLICY" = "Immigration Policy"
)

BAM_LABELS <- c(
  "AMERICAN"          = "American Identity",
  "CULTURAL_IDENTITY" = "Cultural Identity",
  "KEEPSPAN"          = "Maintain Spanish",
  "DISTINCT"          = "Cultural Distinction",
  "LEARNENG"          = "Learn English"
)

label_vars <- function(x) unname(VAR_LABELS[x])
```

\newpage

# Appendix A: BAM Operationalization and Cluster Validation

This appendix summarizes the Bidimensional Acculturation Model (BAM)
operationalization and the validation of the $k$ = 4 GMM clustering
solution. Full methodological details, including bootstrap stability
analysis and cross-validation, are documented in the companion BAM
repository (Grijalva, 2026).

## A.1 Survey Items

```{r tbl-a1-bam-items}
#| label: tbl-a1-bam-items
#| tbl-cap: "Table A1: BAM Acculturation Variables"

bam_items <- tibble(
  Variable = BAM_LABELS[vr$VARS5],
  Code = vr$VARS5,
  Scale = c("1--4", "1--4", "1--4", "1--3", "1--4"),
  Dimension = c("American", "Heritage", "Heritage", "Heritage", "American")
)

bam_items %>%
  kable(booktabs = TRUE,
        col.names = c("Variable", "Code", "Scale", "Dimension"),
        align = c("l", "l", "c", "c")) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} Variables drawn from the 2006 Latino National Survey (LNS; ICPSR Study 20862). Cultural Identity is the mean of regional and Latino ethnic identity items. All items standardized before clustering.

## A.2 Cluster Performance

```{r tbl-a2-cluster-performance}
#| label: tbl-a2-cluster-performance
#| tbl-cap: "Table A2: Comparative Cluster Performance at $k$ = 4"

comp_k4 <- vr$comp_table %>%
  filter(k == 4, status == "ok") %>%
  select(method, silhouette, ch, sizes) %>%
  mutate(
    silhouette = sprintf("%.2f", silhouette),
    ch = sprintf("%.2f", ch)
  )

comp_k4 %>%
  kable(booktabs = TRUE,
        col.names = c("Algorithm", "Silhouette", "CH Index", "Cluster Sizes"),
        align = c("l", "r", "r", "l")) %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                full_width = FALSE)
```

\noindent \textit{Note:} Silhouette width ranges from $-$1 to 1 (higher = better separation). CH = Calinski-Harabasz index (higher = better). GMM (EEV) selected based on highest silhouette and theoretical interpretability. $N$ = `r format(n_total, big.mark = ",")`.

## A.3 Rationale for $k$ = 4

The four-cluster GMM solution was selected based on converging evidence:
(a) highest average silhouette width among viable solutions ($k$ = 3--5),
(b) theoretically interpretable profiles mapping onto the bidimensional
acculturation framework (Berry, 1997; Schwartz et al., 2010),
(c) bootstrap stability (ARI $>$ 0.80 across $B$ = 1,000 resamples), and
(d) consistent recovery in 5-fold cross-validation.

## A.4 Cluster Means

```{r tbl-a3-cluster-means}
#| label: tbl-a3-cluster-means
#| tbl-cap: "Table A3: Standardized Cluster Means by Acculturation Variable"

means_tbl <- vr$z_means

means_tbl %>%
  mutate(across(where(is.numeric), ~ sprintf("%.2f", .x))) %>%
  kable(booktabs = TRUE,
        align = c("l", rep("r", ncol(means_tbl) - 1))) %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                full_width = FALSE)
```

\noindent \textit{Note:} Values are $z$-scored means within each orientation. Positive values indicate above-average endorsement; negative values indicate below-average endorsement.

\newpage

# Appendix B: Political Variable Coding

```{r tbl-b1-coding}
#| label: tbl-b1-coding
#| tbl-cap: "Table B1: Political Variable Coding"

coding_tbl <- tibble(
  Variable = c("Ideology", "Party Identification", "Immigration View",
               "DREAM Act Support", "Immigration Policy"),
  Code = c("IDEOLOGY", "PARTYID", "IMMVIEW", "DREAMACT", "IMMPOLICY"),
  Scale = c("1--3", "1--3", "1--2", "1--4", "1--5"),
  Labels = c("1 = Conservative, 2 = Moderate, 3 = Liberal",
             "1 = Republican, 2 = Independent, 3 = Democrat",
             "1 = Burden, 2 = Strengthen country",
             "1 = Strongly oppose to 4 = Strongly support",
             "1 = Most restrictive to 5 = Most permissive")
)

coding_tbl %>%
  kable(booktabs = TRUE,
        col.names = c("Variable", "Code", "Scale", "Value Labels"),
        align = c("l", "l", "c", "l")) %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                full_width = FALSE)
```

\noindent \textit{Note:} All variables from the 2006 Latino National Survey (LNS; ICPSR Study 20862). See LNS codebook for original question wording.

# Appendix C: Detailed Within-Orientation Distributions

```{r tbl-c1-ideology}
#| label: tbl-c1-ideology
#| tbl-cap: "Table C1: Ideology Distribution by Orientation"

ideology_dist %>%
  mutate(across(starts_with("pct"), ~ round(.x, 1)),
         across(c(mean, sd), ~ round(.x, 2))) %>%
  kable(booktabs = TRUE,
        col.names = c("Orientation", "n", "% Cons.", "% Mod.", "% Lib.", "M", "SD"),
        align = c("l", rep("r", 6))) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} Ideology coded 1 = Conservative, 2 = Moderate, 3 = Liberal.

```{r tbl-c2-partyid}
#| label: tbl-c2-partyid
#| tbl-cap: "Table C2: Party Identification by Orientation"

partyid_dist %>%
  mutate(across(starts_with("pct"), ~ round(.x, 1)),
         across(c(mean, sd), ~ round(.x, 2))) %>%
  kable(booktabs = TRUE,
        col.names = c("Orientation", "n", "% Rep.", "% Ind.", "% Dem.", "M", "SD"),
        align = c("l", rep("r", 6))) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} Party ID coded 1 = Republican, 2 = Independent, 3 = Democrat.

```{r tbl-c3-immigration}
#| label: tbl-c3-immigration
#| tbl-cap: "Table C3: Immigration Attitudes by Orientation"

imm_summary <- bind_cols(
  immview_dist %>% select(cluster, n, pct_burden, pct_strengthen),
  dreamact_dist %>% select(mean, sd) %>% rename(dream_M = mean, dream_SD = sd),
  immpolicy_dist %>% select(mean, sd) %>% rename(policy_M = mean, policy_SD = sd)
) %>%
  mutate(
    across(starts_with("pct"), ~ round(.x, 1)),
    across(c(dream_M, dream_SD, policy_M, policy_SD), ~ round(.x, 2))
  )

imm_summary %>%
  kable(booktabs = TRUE,
        col.names = c("Orientation", "n", "% Burden", "% Strengthen",
                       "DREAM M", "DREAM SD", "Policy M", "Policy SD"),
        align = c("l", rep("r", 7))) %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                full_width = FALSE)
```

\noindent \textit{Note:} Immigration view coded 1 = Burden, 2 = Strengthen. DREAM Act on 1--4 scale. Immigration policy on 1--5 scale.

\newpage

# Appendix D: Full Pairwise Comparisons

```{r tbl-d1-pairwise}
#| label: tbl-d1-pairwise
#| tbl-cap: "Table D1: All 30 Pairwise Effect Sizes with FDR-Corrected $p$-values"

pairwise_results_full %>%
  mutate(
    Variable = label_vars(Variable),
    across(c(Delta, CI_low, CI_high), ~ round(.x, 2)),
    p_fdr = ifelse(as.numeric(p_fdr) < 0.001, "< .001", sprintf("%.3f", p_fdr)),
    Comparison = paste0(substr(Group1, 1, 3), " vs ", substr(Group2, 1, 3)),
    CI = paste0("[", CI_low, ", ", CI_high, "]")
  ) %>%
  select(Variable, Comparison, Delta, CI, p_fdr, Sig_fdr, Magnitude) %>%
  kable(booktabs = TRUE,
        col.names = c("Variable", "Comparison", "$\\delta$", "95\\% CI",
                       "$p_{\\text{FDR}}$", "Sig.", "Magnitude"),
        escape = FALSE,
        align = c("l", "l", "r", "c", "r", "c", "l")) %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                full_width = FALSE, font_size = 8)
```

\noindent \textit{Note:} Cliff's $\delta$ with 95\% bootstrap CIs ($B$ = `r format(n_boot, big.mark = ",")`, seed = `r SEED`). Wilcoxon rank-sum $p$-values corrected via Benjamini-Hochberg FDR across 30 comparisons. Magnitude: $|\delta| \geq$ 0.11 (small), $\geq$ 0.28 (medium), $\geq$ 0.43 (large).

\newpage

# Appendix E: Within-Orientation Heterogeneity

```{r tbl-e1-cv}
#| label: tbl-e1-cv
#| tbl-cap: "Table E1: Coefficient of Variation by Orientation and Variable"

cv_wide %>%
  mutate(across(-cluster, ~ round(.x, 2))) %>%
  kable(booktabs = TRUE,
        col.names = c("Orientation", label_vars(dvs)),
        align = c("l", rep("r", 5))) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} CV = coefficient of variation (SD/M). Higher values indicate greater within-orientation political heterogeneity.

```{r tbl-e2-levene}
#| label: tbl-e2-levene
#| tbl-cap: "Table E2: Levene's Test for Equality of Variances"

levene_results %>%
  mutate(
    Variable = label_vars(Variable),
    F_statistic = round(F_statistic, 2),
    p_value = ifelse(p_value < 0.001, "< .001", sprintf("%.3f", p_value))
  ) %>%
  kable(booktabs = TRUE,
        col.names = c("Variable", "$F$", "df$_1$", "df$_2$", "$p$"),
        escape = FALSE,
        align = c("l", rep("r", 4))) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} Levene's test (Brown-Forsythe, median-based). Significant results indicate unequal variances across orientations.

```{r tbl-e3-variance}
#| label: tbl-e3-variance
#| tbl-cap: "Table E3: Variance by Orientation and Variable"

var_wide <- variance_by_group %>%
  pivot_wider(names_from = Variable, values_from = Variance)

var_wide %>%
  mutate(across(-cluster, ~ round(.x, 2))) %>%
  kable(booktabs = TRUE,
        col.names = c("Orientation", label_vars(dvs)),
        align = c("l", rep("r", 5))) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} Sample variances for each political outcome by acculturation orientation.

\newpage

# Appendix F: Key Contrast Detail

```{r tbl-f1-key-contrast}
#| label: tbl-f1-key-contrast
#| tbl-cap: "Table F1: Assimilationist vs Bicultural (Heritage Maintenance Effect)"

key_contrast %>%
  mutate(
    Variable = label_vars(Variable),
    across(c(Delta, CI_low, CI_high), ~ round(.x, 2)),
    CI = paste0("[", CI_low, ", ", CI_high, "]")
  ) %>%
  select(Variable, Delta, CI, Significant, Magnitude) %>%
  kable(booktabs = TRUE,
        col.names = c("Variable", "$\\delta$", "95\\% CI",
                       "Significant", "Magnitude"),
        escape = FALSE,
        align = c("l", "r", "c", "c", "l")) %>%
  kable_styling(latex_options = c("hold_position"), full_width = FALSE)
```

\noindent \textit{Note:} Both orientations score high on American cultural orientation; differences isolate the incremental effect of heritage cultural maintenance on political attitudes.

# Appendix G: Dimension Contrasts

```{r tbl-g1-dimensions}
#| label: tbl-g1-dimensions
#| tbl-cap: "Table G1: Dimension Contrasts (Heritage vs American)"

dimension_results %>%
  mutate(
    Variable = label_vars(Variable),
    across(c(Delta, CI_low, CI_high), ~ round(.x, 2)),
    CI = paste0("[", CI_low, ", ", CI_high, "]")
  ) %>%
  select(Dimension, Variable, Delta, CI, Significant) %>%
  arrange(Dimension, Variable) %>%
  kable(booktabs = TRUE,
        col.names = c("Dimension", "Variable", "$\\delta$", "95\\% CI",
                       "Significant"),
        escape = FALSE,
        align = c("l", "l", "r", "c", "c")) %>%
  kable_styling(latex_options = c("hold_position", "scale_down"),
                full_width = FALSE)
```

\noindent \textit{Note:} Cliff's $\delta$ comparing high vs. low on each acculturation dimension. Heritage: Culture Affirming + Bicultural vs. Assimilationist + Demicultural. American: Assimilationist + Bicultural vs. Culture Affirming + Demicultural. 95\% bootstrap CIs ($B$ = `r format(n_boot, big.mark = ",")`, seed = `r SEED`).

\newpage

# Appendix H: Software

```{r session-info}
#| label: session-info

sessionInfo()
```
